package service

import (
	__ "base_srv/basic/baseproto"
	"base_srv/handler/dao"
	"context"
)

// OrganizationAdd 机构信息添加
func (s *Server) OrganizationAdd(_ context.Context, in *__.OrganizationAddReq) (*__.OrganizationAddResp, error) {
	id, err := dao.OrganizationAdd(in)
	if err != nil {
		return nil, err
	}
	return &__.OrganizationAddResp{Id: int64(id)}, nil
}

// OrganizationUpdate 机构信息更新
func (s *Server) OrganizationUpdate(_ context.Context, in *__.OrganizationUpdateReq) (*__.OrganizationUpdateResp, error) {
	err := dao.OrganizationUpdate(in)
	if err != nil {
		return nil, err
	}
	return &__.OrganizationUpdateResp{Id: in.Id}, nil
}

// 经营许可证信息添加
func (s *Server) BusinessLicenseInformationAdd(_ context.Context, in *__.BusinessLicenseInformationAddReq) (*__.BusinessLicenseInformationAddResp, error) {
	id, err := dao.BusinessLicenseInformationAdd(in)
	if err != nil {
		return nil, err
	}
	return &__.BusinessLicenseInformationAddResp{Id: int64(id)}, nil
}

// 经营许可证信息更新
func (s *Server) BusinessLicenseInformationUpdate(_ context.Context, in *__.BusinessLicenseInformationUpdateReq) (*__.BusinessLicenseInformationUpdateResp, error) {
	err := dao.BusinessLicenseInformationUpdate(in)
	if err != nil {
		return nil, err
	}
	return &__.BusinessLicenseInformationUpdateResp{Id: int64(in.Id)}, nil
}
